package com.rd.student.jike.class1.sunhao.day02;

import java.util.LinkedList;

public class RemoveUtils {
    public  static void rU(LinkedList linkedList,String name1){
        for (int i=0;i<linkedList.size();i++){
            if (linkedList.size()==1) {
                System.out.println("处理失败");
                break;
            }
            if(((Student )linkedList.get(i)).name.equals(name1)){
                linkedList.remove(i);
                System.out.println("删除成功");
                break;
            }
            System.out.println("处理失败");

        }

    }
    public  static void rU(LinkedList linkedList,int num1){
        for (int i=0;i<linkedList.size();i++){
            if (linkedList.size()==1) {
                System.out.println("处理失败");
                break;
            }

            if(((Student )linkedList.get(i)).num==num1 ){
                linkedList.remove(i);
                System.out.println("删除成功");
            }
        }
        System.out.println("处理失败");

    }
}
